package com.salton123.groupbargain.ui.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.salton123.bmob.bargain.BargainItem
import com.salton123.groupbargain.R
import com.salton123.utils.ImageLoader

/**
 * User: newSalton@outlook.com
 * Date: 2020-01-26 20:31
 * ModifyTime: 20:31
 * Description:
 */
class BargainRecommendItemAdapter :
    BaseQuickAdapter<BargainItem,
            BaseViewHolder>(
        R.layout.adapter_item_bargain_recommend
    ) {
    override fun convert(helper: BaseViewHolder, item: BargainItem?) {
        helper.apply {
            setText(R.id.tvName, item?.bargainTitle)
            setText(R.id.tvInstall, "+" + item?.bargainPrice)
            setText(R.id.tvType, BargainItem.getTypeStr(item?.bargainType))
            setText(R.id.tvCurrentStatus, "剩余数量：${item?.remindCount}/${item?.totalCount}")
            ImageLoader.loadCenterCrop(getView(R.id.ivIcon), item?.fromUserIcon)
        }
    }
}